//
//  SecondViewController.m
//  UI_元旦豆瓣小集合
//
//  Created by dllo on 15/12/31.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "SecondViewController.h"
#import "PB2TableViewCell.h"
#import "TenViewController.h"
@interface SecondViewController ()<UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, retain) UITableView *tableview;
@property (nonatomic, retain) NSMutableArray *arrArr;
@property (nonatomic, retain) NSMutableArray *arrData;

@end

@implementation SecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor yellowColor];
    self.title = @"电影";
    self.tableview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    _tableview.delegate = self;
    _tableview.dataSource = self;
    [self.view addSubview:_tableview];
    [_tableview release];
    
    NSString *path = [[NSBundle mainBundle] pathForResource:@"movie" ofType:@"plist"];
    self.arrData = [NSMutableArray arrayWithContentsOfFile:path];
    
    UIBarButtonItem *itme = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"movie1.png"] style:UIBarButtonItemStyleDone target:self action:@selector(youAction:)];
    itme.tintColor = [UIColor blackColor];
    self.navigationItem.rightBarButtonItem = itme;
    //UIBarButtonItem *rightItme = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"right.png"] style:UIBarButtonItemStyleDone target:self action:@selector(rightAction:)];
   // rightItme.tintColor = [UIColor whiteColor];
    //self.navigationItem.rightBarButtonItem = rightItme;

}
- (void)youAction:(UIBarButtonItem *)button {
    TenViewController *SeVc = [[TenViewController alloc] init];
    [self.navigationController pushViewController:SeVc animated:YES];
    
    [SeVc release];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 180;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _arrData.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    PB2TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[PB2TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    cell.img2.image = [UIImage imageNamed:@"4.png"];
    cell.img2.layer.cornerRadius = 5;
    cell.img2.layer.masksToBounds = YES;
    cell.img1.image = [UIImage imageNamed:[NSString stringWithFormat:@"%ld.jpg",indexPath.row + 1]];
    cell.word.text = _arrData[indexPath.row][@"title"];
    
    
    return cell;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
       // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
